package com.eco.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eco.dao.ds3.SensorMapper;
import com.eco.entity.Sensor;
import com.eco.service.SensorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SensorServiceImpl extends ServiceImpl<SensorMapper,Sensor> implements SensorService {
    @Autowired
    private SensorMapper scanMapper;

    @Override
    public int addByScan(Sensor scan) {
        return this.scanMapper.addByScan(scan);
    }

    @Override
    public IPage<Sensor> findByStime(String startDate, String endDate, int pageNum, int pageSize) {
        IPage<Sensor> page = this.scanMapper.findByStime(new Page<Sensor>(pageNum,pageSize),startDate, endDate);
        return page;
    }

    @Override
    public int countByStime(String startDate, String endDate) {
        return this.scanMapper.countByStime(startDate, endDate);
    }
}
